package com.ccBatis.sqlSession;

import com.ccBatis.config.XMLConfigBuilder;
import com.ccBatis.pojo.Configuration;
import org.dom4j.DocumentException;

import java.io.InputStream;

public class SqlSessionFactoryBuilder {


    public SqlSessionFactory build(InputStream inputStream) throws DocumentException {

        //1.解析配置文件，封装容器对象 XMLConfigBuilder
        XMLConfigBuilder xmlConfigBuilder =  new XMLConfigBuilder();
        Configuration configuration =  xmlConfigBuilder.parse(inputStream);
        return new DefaultSqlSessionFactory(configuration);
    }
}
